package com.softWang.file.config;

import com.softWang.file.constants.FilesConstant;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 通用配置
 * 
 * @author ruoyi
 */
@Configuration
public class ResourceConfig implements WebMvcConfigurer
{
    @Value("${file.savePath}")
    private  String savePath;
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry)
    {
        /** 本地文件映射 */
        registry.addResourceHandler(FilesConstant.RESOURCE_PREFIX + "/**")
                .addResourceLocations("file:" + savePath + "/");
    }

}